package router

import (
	"common/config"
	gateApi "gate/api"
	"gate/cors"
	"github.com/gin-gonic/gin"
)

func InitRouter() *gin.Engine {
	if config.Conf.Log.Level == "DEBUG" {
		gin.SetMode(gin.DebugMode)
	} else {
		gin.SetMode(gin.ReleaseMode)
	}
	helloHandler := gateApi.NewHelloHandler()
	userHandler := gateApi.NewUserHandler()
	engine := gin.Default()
	engine.Use(cors.Cors())
	/*group := engine.Group("/v1")
	userRouter := group.Group("user")
	{
		userRouter.POST("/hello", handler.Hello)
	}*/
	engine.POST("/hello", helloHandler.Hello)
	engine.POST("/register", userHandler.Register)
	return engine
}
